package com.ysstech.reportworld.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 报表世界SQL脚本管理表
 * </p>
 *
 * @author lishuangliang
 * @since 2023-01-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("report_world_sql_script")
public class SqlScript extends Model<SqlScript> {

    private static final long serialVersionUID = 1L;

    @TableId("ID")
    private String id;

    /**
     * SQL脚本
     */
    @TableField("SQL_SCRIPT")
    private String sqlScript;

    /**
     * 客户编号
     */
    @TableField("CUSTOMER_ID")
    private String customerId;
    /**
     * 报表编号
     */
    @TableField("REPORT_ID")
    private String reportId;

    /**
     * 模块编号
     */
    @TableField("MODULAR_ID")
    private String modularId;

    /**
     * 需求BUG编号
     */
    @TableField("DEMAND_BUG_ID")
    private String demandBugId;
    /**
     * 来源 1. 报表世界 2，GZ45
     */
    @TableField("FSOURCE")
    private Integer fsource;

    /**
     * 报表世界所在分层
     */
    @TableField("LAYERED")
    private Integer layered;

    /**
     * SQL对应的的数据库类型
     */
    @TableField("DATABASE_TYPE")
    private String dataBaseType;

    /**
     * 脚本是否按照业务主键覆盖
     */
    @TableField("COVER_PRIMARY_KEY")
    private Integer coverPrimaryKey;

    /**
     * 版本号
     */
    @TableField("VERSION")
    private String version;

    /**
     * 说明
     */
    @TableField("DESCRIPTION")
    private String description;

    @TableField("STATUS")
    private Integer status;
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField("ADD_TIME")
    private LocalDateTime addTime;

    @TableField("ADD_USER")
    private String addUser;

    /**
     * 添加人中文名称和企业微信名字相同
     */
    @TableField("ADD_USER_NAME")
    private String addUserName;
    /**
     * 机器人地址
     */
    @TableField("ADD_WECOM_URL")
    private String addWecomUrl;

    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField("EDIT_TIME")
    private LocalDateTime editTime;

    @TableField("EDIT_USER")
    private String editUser;


    @TableField("APPROVAL_USER")
    private String approvalUser;

    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField("APPROVAL_TIME")
    private LocalDateTime approvalTime;

    /**
     * 审核退回原因
     */
    @TableField("APPROVAL_REASON")
    private String approvalReason;

    @Override
    protected Serializable pkVal() {
        return null;
    }


    //报表世界所在分层
    @TableField(exist = false)
    private String strLayered;
    // 状态
    @TableField(exist = false)
    private String strStatus;
    //来源
    @TableField(exist = false)
    private String strFsource;

    //查询的时候
    // 所属模块
    @TableField(exist = false)
    private String strModular;
    //所属客户
    @TableField(exist = false)
    private String strCustomer;
    //所属报表
    @TableField(exist = false)
    private String strReport;
    @TableField(exist = false)
    private List<DataCustomer> listCustomer;
    @TableField(exist = false)
    private List<DataModular> listModular;
    @TableField(exist = false)
    private List<DataReport> listReport;


    // 所属模块
    @TableField(exist = false)
    private String modularName;
    //所属客户
    @TableField(exist = false)
    private String customerName;
    //所属报表
    @TableField(exist = false)
    private String reportName;
    //需求BUG编号
    @TableField(exist = false)
    private String demandBugNum;
    //需求BUG编号类型
    @TableField(exist = false)
    private Integer demandBugType;

    @TableField(exist = false)
    private Integer count;
}
